﻿<?php
if(!defined('IN_PHPSCUP'))exit('hacking'); 
class CompanyleavewordApp extends BaseApp
{

  
    function index()
    {
         if(!isset($_POST['word']))
		{
		$_POST['word'] = '';
		}
        if(!isset($_GET['v']))
		{
		$_GET['v'] = '';
		}	
	    $word = $_POST['word'];
		$word_array = explode(' ',$word);
		
		foreach($word_array as $key => $value)
		{
			if(!$value)
			{
             unset($word_array[$key]);
		    }  
		}
		 
        $order = '';
		$v = $_GET['v'];
		if($v == 'timeasc')
		{
        $order = 'add_time asc';
		}
		else if($v == 'timedesc')
		{
        $order = 'add_time desc';		
		}
		else if($v == 'seeyes')
		{
        $order = 'see desc';		
		}
		else if($v == 'seeno')
		{
        $order = 'see asc';		
		}
		else if($v == 'dealyes')
		{
        $order = 'deal desc';		
		}
		else if($v == 'dealno')
		{
        $order = 'deal asc';		
		}
	
	 	 $TB_company= &$this->_model('company');		 		 		
		 $companydata = $TB_company->oneshow($GLOBALS['SCup']->SCup_user_msg['user_id']);
			 	
		$TB_leaveword = &$this->_model('companyleaveword'); 				
		$data = $TB_leaveword->show($order,$v,$word_array,$companydata['id']);	
			
        $this->assign('lw_data', $data['data']);		
		$this->assign('lw_page', $data['page']);		 	
	    
        $this->assign('view_charset', VIEW_CHARSET);	
        $this->assign('page_title', $GLOBALS['Lang']->_get_lang_var(SITE_TITLE));
        $this->assign('page_description', $GLOBALS['Lang']->_get_lang_var(SITE_DESCRIPTION));
        $this->assign('page_keywords', $GLOBALS['Lang']->_get_lang_var(SITE_KEYWORDS));	
		$this->assign('word', $word);
		$this->assign('v', $v);
		
        $this->assign('site_url',SITE_URL);
		
        $this->assign('web_view_dir',SITE_URL.'/admin/view/default/');

		
        $this->display('company/companyleavewordlist.view.html');
    }



    function search()
    {
	
	    $word = $_POST['word'];		
	 	 $TB_company= &$this->_model('company');		 		 		
		 $companydata = $TB_company->oneshow($GLOBALS['SCup']->SCup_user_msg['user_id']);		
						
		$TB_leaveword = &$this->_model('companyleaveword');
		
		if($s ==0)
		{						
		 $TB_leaveword->oneedit('see',$id,1,$companydata['id']);
		}
								
		$data = $TB_leaveword->oneshow($id,$companydata['id']);
		

		
        $this->assign('data', $data);
				
        $this->assign('view_charset', VIEW_CHARSET);	
        $this->assign('page_title', $GLOBALS['Lang']->_get_lang_var(SITE_TITLE));
        $this->assign('page_description', $GLOBALS['Lang']->_get_lang_var(SITE_DESCRIPTION));
        $this->assign('page_keywords', $GLOBALS['Lang']->_get_lang_var(SITE_KEYWORDS));	
		
        $this->assign('site_url',SITE_URL);
		
        $this->assign('web_view_dir',SITE_URL.'/admin/view/default/');      
		
        $this->display('company/companyleavewordcontent.view.html');

    }	


    function lsee()
    {
	
	
	    $id = $_GET['id'];
		$s = $_GET['s'];		
	 	 $TB_company= &$this->_model('company');		 		 		
		 $companydata = $TB_company->oneshow($GLOBALS['SCup']->SCup_user_msg['user_id']);
						
		$TB_leaveword = &$this->_model('companyleaveword');
		
		if($s ==0)
		{						
		 $TB_leaveword->oneedit('see',$id,1,$companydata['id']);
		}
								
		$data = $TB_leaveword->oneshow($id,$companydata['id']);
		

		
        $this->assign('data', $data);
				
        $this->assign('view_charset', VIEW_CHARSET);	
        $this->assign('page_title', $GLOBALS['Lang']->_get_lang_var(SITE_TITLE));
        $this->assign('page_description', $GLOBALS['Lang']->_get_lang_var(SITE_DESCRIPTION));
        $this->assign('page_keywords', $GLOBALS['Lang']->_get_lang_var(SITE_KEYWORDS));	
		
        $this->assign('site_url',SITE_URL);
		
        $this->assign('web_view_dir',SITE_URL.'/admin/view/default/');      
		
        $this->display('company/companyleavewordcontent.view.html');

    }	

    function ldeal()
    {
	
	
	    $id = $_GET['id'];
		$s = $_GET['s'];		
	 	 $TB_company= &$this->_model('company');		 		 		
		 $companydata = $TB_company->oneshow($GLOBALS['SCup']->SCup_user_msg['user_id']);
						
		$TB_leaveword = &$this->_model('companyleaveword');
		
		if($s ==0)
		{						
		 $TB_leaveword->oneedit('deal',$id,1,$companydata['id']);
		}
		else
		{
		 $TB_leaveword->oneedit('deal',$id,0,$companydata['id']);		
		}
		
        $this->index();

    }	


    function del()
    {
	     $id = $_GET['id'];
		 
	 	 $TB_company= &$this->_model('company');		 		 		
		 $companydata = $TB_company->oneshow($GLOBALS['SCup']->SCup_user_msg['user_id']);		 
		$TB_leaveword = &$this->_model('companyleaveword'); 	 
			 
		 $TB_leaveword->del($id,$companydata['id']);	
		  
		 $this->index();	  

    }
		
   
}







?>